//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.customer;

import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.*;
import org.jpgolay.gui.fixed.*;
import org.jpgolay.gui.iconBar.IconBar;
import org.jpgolay.me.util.MEUtility;

public class CustomerGUI extends JInternalFrame {

    public CustomerGUI() {
        jContentPane = null;
        basicMenu = null;
        iconBar = null;
        mainPanel = null;
        customerSearch = null;
        jTabbedPane = null;
        addressPanel = null;
        infosPanel = null;
        jTabbedPane1 = null;
        salesAddressPanel = null;
        shippingAddressPanel = null;
        companyPanel = null;
        companyLabelAndTextField = null;
        statusLabelAndComboBox = null;
        salesAddrLn1abelAndTextField = null;
        salesAddrLn2abelAndTextField = null;
        salesCityLabelAndTextField = null;
        salesCountryLabelAndTextField = null;
        salesZipLabelAndTextField = null;
        contactPanel = null;
        contactLabelAndTextField = null;
        jobContactLabelAndTextField = null;
        telLabelAndTextField = null;
        faxLabelAndTextField = null;
        shippingAddrLn1LabelAndTextField = null;
        shippingAddrLn2LabelAndTextField = null;
        shippingCityLabelAndTextField = null;
        shippingZipLabelAndTextField = null;
        shippingCountryLabelAndTextField = null;
        glnLabelAndTextField = null;
        emailLabelAndTextField = null;
        webLabelAndTextField = null;
        tel2LabelAndTextField = null;
        familyLabelAndComboBox = null;
        bankNumberLabelAndTextField = null;
        lastUserLabelAndTextField = null;
        lastTimeLabelAndTextField = null;
        idLabelAndTextField = null;
        jScrollPane = null;
        notesJTextArea = null;
        accountingPanel = null;
        discountPanel = null;
        jTabbedPane2 = null;
        itemDiscountPanel = null;
        familyItemDiscountPanel = null;
        itemDiscountTableViewer = null;
        familyItemDiscountTableViewer = null;
        salesPersonLabelAndComboBox = null;
        paymentModeLabelAndComboBox = null;
        paymentDelayLabelAndComboBox = null;
        discountLabelAndTextField = null;
        extraDiscountLabelAndTextField = null;
        extraDiscountLevelLabelAndTextField = null;
        totalPaymentLabelAndTextField = null;
        itemSearch = null;
        itemDiscountOptionPanel = null;
        netPriceCalculatorCheckBox = null;
        jScrollPane1 = null;
        initialize();
    }

    private void initialize() {
        setJMenuBar(getBasicMenu());
        setFrameIcon(new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")));
        setTitle("CLIENT");
        setSize(340, 482);
        setContentPane(getJContentPane());
    }

    private JPanel getJContentPane() {
        if (jContentPane == null) {
            jContentPane = new JPanel();
            jContentPane.setLayout(new BorderLayout());
            jContentPane.add(getIconBar(), "North");
            jContentPane.add(getMainPanel(), "Center");
        }
        return jContentPane;
    }

    private BasicMenu getBasicMenu() {
        if (basicMenu == null) {
            basicMenu = new BasicMenu();
        }
        return basicMenu;
    }

    private IconBar getIconBar() {
        if (iconBar == null) {
            iconBar = new IconBar();
        }
        return iconBar;
    }

    private JPanel getMainPanel() {
        if (mainPanel == null) {
            mainPanel = new JPanel();
            mainPanel.setLayout(new BorderLayout());
            mainPanel.add(getCustomerSearch(), "North");
            mainPanel.add(getJScrollPane1(), "Center");
        }
        return mainPanel;
    }

    private SearchBox getCustomerSearch() {
        if (customerSearch == null) {
            customerSearch = new SearchBox();
            customerSearch.setPreferredSize(customerSearch.getSize());
            customerSearch.addPropertyChangeListener("icon", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent e) {
                    customerSearch.setPreferredSize(customerSearch.getSize());
                    getMainPanel().revalidate();
                }
            });
        }
        return customerSearch;
    }

    private JTabbedPane getJTabbedPane() {
        if (jTabbedPane == null) {
            jTabbedPane = new JTabbedPane();
            jTabbedPane.setPreferredSize(new Dimension(306, 380));
            jTabbedPane.addTab("Coordonn\351es", null, getAddressPanel(), null);
            jTabbedPane.addTab("Infos", null, getInfosPanel(), null);
            jTabbedPane.addTab("Compta", null, getAccountingPanel(), null);
            jTabbedPane.addTab("Remises", null, getDiscountPanel(), null);
        }
        return jTabbedPane;
    }

    private JPanel getAddressPanel() {
        if (addressPanel == null) {
            addressPanel = new JPanel();
            addressPanel.setLayout(new BorderLayout());
            addressPanel.add(getCompanyPanel(), "North");
            addressPanel.add(getJTabbedPane1(), "Center");
            addressPanel.add(getContactPanel(), "South");
        }
        return addressPanel;
    }

    private JPanel getInfosPanel() {
        if (infosPanel == null) {
            FlowLayout flowLayout6 = new FlowLayout();
            infosPanel = new JPanel();
            infosPanel.setLayout(flowLayout6);
            flowLayout6.setVgap(2);
            infosPanel.add(getIdLabelAndTextField(), null);
            infosPanel.add(getFamilyLabelAndComboBox(), null);
            infosPanel.add(getGlnLabelAndTextField(), null);
            infosPanel.add(getBankNumberLabelAndTextField(), null);
            infosPanel.add(getTel2LabelAndTextField(), null);
            infosPanel.add(getEmailLabelAndTextField(), null);
            infosPanel.add(getWebLabelAndTextField(), null);
            infosPanel.add(getJScrollPane(), null);
            infosPanel.add(getLastTimeLabelAndTextField(), null);
            infosPanel.add(getLastUserLabelAndTextField(), null);
        }
        return infosPanel;
    }

    private JTabbedPane getJTabbedPane1() {
        if (jTabbedPane1 == null) {
            jTabbedPane1 = new JTabbedPane();
            jTabbedPane1.setPreferredSize(new Dimension(310, 150));
            jTabbedPane1.addTab("Adresse de facturation", null, getSalesAddressPanel(), null);
            jTabbedPane1.addTab("Adresse de livraison", null, getShippingAddressPanel(), null);
        }
        return jTabbedPane1;
    }

    private JPanel getSalesAddressPanel() {
        if (salesAddressPanel == null) {
            FlowLayout flowLayout3 = new FlowLayout();
            salesAddressPanel = new JPanel();
            salesAddressPanel.setLayout(flowLayout3);
            flowLayout3.setVgap(2);
            salesAddressPanel.setPreferredSize(new Dimension(308, 150));
            salesAddressPanel.add(getSalesAddrLn1abelAndTextField(), null);
            salesAddressPanel.add(getSalesAddrLn2abelAndTextField(), null);
            salesAddressPanel.add(getSalesCityLabelAndTextField(), null);
            salesAddressPanel.add(getSalesZipLabelAndTextField(), null);
            salesAddressPanel.add(getSalesCountryLabelAndTextField(), null);
        }
        return salesAddressPanel;
    }

    private JPanel getShippingAddressPanel() {
        if (shippingAddressPanel == null) {
            FlowLayout flowLayout2 = new FlowLayout();
            shippingAddressPanel = new JPanel();
            shippingAddressPanel.setLayout(flowLayout2);
            flowLayout2.setVgap(2);
            shippingAddressPanel.setPreferredSize(new Dimension(308, 150));
            shippingAddressPanel.add(getShippingAddrLn1LabelAndTextField(), null);
            shippingAddressPanel.add(getShippingAddrLn2LabelAndTextField(), null);
            shippingAddressPanel.add(getShippingCityLabelAndTextField(), null);
            shippingAddressPanel.add(getShippingZipLabelAndTextField(), null);
            shippingAddressPanel.add(getShippingCountryLabelAndTextField(), null);
        }
        return shippingAddressPanel;
    }

    private JPanel getCompanyPanel() {
        if (companyPanel == null) {
            FlowLayout flowLayout1 = new FlowLayout();
            companyPanel = new JPanel();
            companyPanel.setLayout(flowLayout1);
            flowLayout1.setVgap(2);
            companyPanel.setPreferredSize(new Dimension(627, 60));
            companyPanel.add(getCompanyLabelAndTextField(), null);
            companyPanel.add(getStatusLabelAndComboBox(), null);
        }
        return companyPanel;
    }

    private LabelAndTextField getCompanyLabelAndTextField() {
        if (companyLabelAndTextField == null) {
            companyLabelAndTextField = new LabelAndTextField();
            companyLabelAndTextField.setLabel("Raison social");
        }
        return companyLabelAndTextField;
    }

    private LabelAndComboBox getStatusLabelAndComboBox() {
        if (statusLabelAndComboBox == null) {
            statusLabelAndComboBox = new LabelAndComboBox();
            statusLabelAndComboBox.setLabel("Civilit\351");
            statusLabelAndComboBox.setList(MEUtility.STATUS);
        }
        return statusLabelAndComboBox;
    }

    private LabelAndTextField getSalesAddrLn1abelAndTextField() {
        if (salesAddrLn1abelAndTextField == null) {
            salesAddrLn1abelAndTextField = new LabelAndTextField();
            salesAddrLn1abelAndTextField.setLabel("Adresse");
        }
        return salesAddrLn1abelAndTextField;
    }

    private LabelAndTextField getSalesAddrLn2abelAndTextField() {
        if (salesAddrLn2abelAndTextField == null) {
            salesAddrLn2abelAndTextField = new LabelAndTextField();
            salesAddrLn2abelAndTextField.setLabel(" ");
        }
        return salesAddrLn2abelAndTextField;
    }

    private LabelAndTextField getSalesCityLabelAndTextField() {
        if (salesCityLabelAndTextField == null) {
            salesCityLabelAndTextField = new LabelAndTextField();
            salesCityLabelAndTextField.setLabel("Ville");
        }
        return salesCityLabelAndTextField;
    }

    private LabelAndTextField getSalesCountryLabelAndTextField() {
        if (salesCountryLabelAndTextField == null) {
            salesCountryLabelAndTextField = new LabelAndTextField();
            salesCountryLabelAndTextField.setLabel("Pays");
        }
        return salesCountryLabelAndTextField;
    }

    private LabelAndTextField getSalesZipLabelAndTextField() {
        if (salesZipLabelAndTextField == null) {
            salesZipLabelAndTextField = new LabelAndTextField();
            salesZipLabelAndTextField.setLabel("Code postal");
        }
        return salesZipLabelAndTextField;
    }

    private JPanel getContactPanel() {
        if (contactPanel == null) {
            FlowLayout flowLayout4 = new FlowLayout();
            contactPanel = new JPanel();
            contactPanel.setLayout(flowLayout4);
            contactPanel.setPreferredSize(new Dimension(330, 118));
            flowLayout4.setVgap(2);
            contactPanel.add(getContactLabelAndTextField(), null);
            contactPanel.add(getJobContactLabelAndTextField(), null);
            contactPanel.add(getTelLabelAndTextField(), null);
            contactPanel.add(getFaxLabelAndTextField(), null);
        }
        return contactPanel;
    }

    private LabelAndTextField getContactLabelAndTextField() {
        if (contactLabelAndTextField == null) {
            contactLabelAndTextField = new LabelAndTextField();
            contactLabelAndTextField.setLabel("Contact");
        }
        return contactLabelAndTextField;
    }

    private LabelAndTextField getJobContactLabelAndTextField() {
        if (jobContactLabelAndTextField == null) {
            jobContactLabelAndTextField = new LabelAndTextField();
            jobContactLabelAndTextField.setLabel("Fonction (Contact)");
        }
        return jobContactLabelAndTextField;
    }

    private LabelAndTextField getTelLabelAndTextField() {
        if (telLabelAndTextField == null) {
            telLabelAndTextField = new LabelAndTextField();
            telLabelAndTextField.setLabel("T\351l");
        }
        return telLabelAndTextField;
    }

    private LabelAndTextField getFaxLabelAndTextField() {
        if (faxLabelAndTextField == null) {
            faxLabelAndTextField = new LabelAndTextField();
            faxLabelAndTextField.setLabel("Fax");
        }
        return faxLabelAndTextField;
    }

    private LabelAndTextField getShippingAddrLn1LabelAndTextField() {
        if (shippingAddrLn1LabelAndTextField == null) {
            shippingAddrLn1LabelAndTextField = new LabelAndTextField();
            shippingAddrLn1LabelAndTextField.setLabel("Adresse");
        }
        return shippingAddrLn1LabelAndTextField;
    }

    private LabelAndTextField getShippingAddrLn2LabelAndTextField() {
        if (shippingAddrLn2LabelAndTextField == null) {
            shippingAddrLn2LabelAndTextField = new LabelAndTextField();
            shippingAddrLn2LabelAndTextField.setLabel(" ");
        }
        return shippingAddrLn2LabelAndTextField;
    }

    private LabelAndTextField getShippingCityLabelAndTextField() {
        if (shippingCityLabelAndTextField == null) {
            shippingCityLabelAndTextField = new LabelAndTextField();
            shippingCityLabelAndTextField.setLabel("Ville");
        }
        return shippingCityLabelAndTextField;
    }

    private LabelAndTextField getShippingZipLabelAndTextField() {
        if (shippingZipLabelAndTextField == null) {
            shippingZipLabelAndTextField = new LabelAndTextField();
            shippingZipLabelAndTextField.setLabel("Code postal");
        }
        return shippingZipLabelAndTextField;
    }

    private LabelAndTextField getShippingCountryLabelAndTextField() {
        if (shippingCountryLabelAndTextField == null) {
            shippingCountryLabelAndTextField = new LabelAndTextField();
            shippingCountryLabelAndTextField.setLabel("Pays");
        }
        return shippingCountryLabelAndTextField;
    }

    private LabelAndTextField getGlnLabelAndTextField() {
        if (glnLabelAndTextField == null) {
            FlowLayout flowLayout5 = new FlowLayout();
            glnLabelAndTextField = new LabelAndTextField();
            glnLabelAndTextField.setLayout(flowLayout5);
            glnLabelAndTextField.setLabel("GLN");
            glnLabelAndTextField.setPreferredSize(new Dimension(306, 31));
            flowLayout5.setVgap(2);
        }
        return glnLabelAndTextField;
    }

    private LabelAndTextField getEmailLabelAndTextField() {
        if (emailLabelAndTextField == null) {
            emailLabelAndTextField = new LabelAndTextField();
            emailLabelAndTextField.setLabel("Email");
        }
        return emailLabelAndTextField;
    }

    private LabelAndTextField getWebLabelAndTextField() {
        if (webLabelAndTextField == null) {
            webLabelAndTextField = new LabelAndTextField();
            webLabelAndTextField.setLabel("Site web");
        }
        return webLabelAndTextField;
    }

    private LabelAndTextField getTel2LabelAndTextField() {
        if (tel2LabelAndTextField == null) {
            tel2LabelAndTextField = new LabelAndTextField();
            tel2LabelAndTextField.setLabel("T\351l 2");
        }
        return tel2LabelAndTextField;
    }

    private LabelAndComboBox getFamilyLabelAndComboBox() {
        if (familyLabelAndComboBox == null) {
            familyLabelAndComboBox = new LabelAndComboBox();
            familyLabelAndComboBox.setLabel("Famille");
        }
        return familyLabelAndComboBox;
    }

    private LabelAndTextField getBankNumberLabelAndTextField() {
        if (bankNumberLabelAndTextField == null) {
            bankNumberLabelAndTextField = new LabelAndTextField();
            bankNumberLabelAndTextField.setLabel("N\260 de compte");
        }
        return bankNumberLabelAndTextField;
    }

    private LabelAndTextField getLastUserLabelAndTextField() {
        if (lastUserLabelAndTextField == null) {
            lastUserLabelAndTextField = new LabelAndTextField();
            lastUserLabelAndTextField.setLabel("Modifi\351 par");
            lastUserLabelAndTextField.getTextField().setEditable(false);
        }
        return lastUserLabelAndTextField;
    }

    private LabelAndTextField getLastTimeLabelAndTextField() {
        if (lastTimeLabelAndTextField == null) {
            lastTimeLabelAndTextField = new LabelAndTextField();
            lastTimeLabelAndTextField.setLabel("Derni\350re modification");
            lastTimeLabelAndTextField.getTextField().setEditable(false);
        }
        return lastTimeLabelAndTextField;
    }

    private LabelAndTextField getIdLabelAndTextField() {
        if (idLabelAndTextField == null) {
            idLabelAndTextField = new LabelAndTextField();
            idLabelAndTextField.setLabel("Code");
        }
        return idLabelAndTextField;
    }

    private JScrollPane getJScrollPane() {
        if (jScrollPane == null) {
            jScrollPane = new JScrollPane();
            jScrollPane.setViewportView(getNotesJTextArea());
        }
        return jScrollPane;
    }

    private JTextArea getNotesJTextArea() {
        if (notesJTextArea == null) {
            notesJTextArea = new JTextArea();
            notesJTextArea.setRows(5);
            notesJTextArea.setWrapStyleWord(true);
            notesJTextArea.setLineWrap(true);
            notesJTextArea.setPreferredSize(new Dimension(290, 150));
            notesJTextArea.setToolTipText("Commentaires");
        }
        return notesJTextArea;
    }

    private JPanel getAccountingPanel() {
        if (accountingPanel == null) {
            FlowLayout flowLayout11 = new FlowLayout();
            accountingPanel = new JPanel();
            accountingPanel.setLayout(flowLayout11);
            flowLayout11.setVgap(2);
            accountingPanel.add(getSalesPersonLabelAndComboBox(), null);
            accountingPanel.add(getPaymentModeLabelAndComboBox(), null);
            accountingPanel.add(getPaymentDelayLabelAndComboBox(), null);
            accountingPanel.add(getDiscountLabelAndTextField(), null);
            accountingPanel.add(getExtraDiscountLabelAndTextField(), null);
            accountingPanel.add(getExtraDiscountLevelLabelAndTextField(), null);
            accountingPanel.add(getTotalPaymentLabelAndTextField(), null);
        }
        return accountingPanel;
    }

    private JPanel getDiscountPanel() {
        if (discountPanel == null) {
            discountPanel = new JPanel();
            discountPanel.setLayout(new BorderLayout());
            discountPanel.add(getJTabbedPane2(), "Center");
        }
        return discountPanel;
    }

    private JTabbedPane getJTabbedPane2() {
        if (jTabbedPane2 == null) {
            jTabbedPane2 = new JTabbedPane();
            jTabbedPane2.addTab("Remises Articles", null, getItemDiscountPanel(), null);
            jTabbedPane2.addTab("Remises Familles d'Articles", null, getFamilyItemDiscountPanel(), null);
        }
        return jTabbedPane2;
    }

    private JPanel getItemDiscountPanel() {
        if (itemDiscountPanel == null) {
            itemDiscountPanel = new JPanel();
            itemDiscountPanel.setLayout(new BorderLayout());
            itemDiscountPanel.add(getItemDiscountOptionPanel(), "North");
            itemDiscountPanel.add(getItemDiscountTableViewer(), "Center");
            itemDiscountPanel.add(getItemSearch(), "South");
        }
        return itemDiscountPanel;
    }

    private JPanel getFamilyItemDiscountPanel() {
        if (familyItemDiscountPanel == null) {
            familyItemDiscountPanel = new JPanel();
            familyItemDiscountPanel.setLayout(new BorderLayout());
            familyItemDiscountPanel.add(getFamilyItemDiscountTableViewer(), "Center");
        }
        return familyItemDiscountPanel;
    }

    private TableViewer getItemDiscountTableViewer() {
        if (itemDiscountTableViewer == null) {
            itemDiscountTableViewer = new TableViewer();
        }
        return itemDiscountTableViewer;
    }

    private TableViewer getFamilyItemDiscountTableViewer() {
        if (familyItemDiscountTableViewer == null) {
            familyItemDiscountTableViewer = new TableViewer();
        }
        return familyItemDiscountTableViewer;
    }

    private LabelAndComboBox getSalesPersonLabelAndComboBox() {
        if (salesPersonLabelAndComboBox == null) {
            salesPersonLabelAndComboBox = new LabelAndComboBox();
            salesPersonLabelAndComboBox.setLabel("Commercial");
        }
        return salesPersonLabelAndComboBox;
    }

    private LabelAndComboBox getPaymentModeLabelAndComboBox() {
        if (paymentModeLabelAndComboBox == null) {
            paymentModeLabelAndComboBox = new LabelAndComboBox();
            paymentModeLabelAndComboBox.setLabel("Mode de r\351glement");
            paymentModeLabelAndComboBox.setList(MEUtility.PAYMENT_MODE);
            paymentModeLabelAndComboBox.setSelectedIndex(0);
        }
        return paymentModeLabelAndComboBox;
    }

    private LabelAndComboBox getPaymentDelayLabelAndComboBox() {
        if (paymentDelayLabelAndComboBox == null) {
            paymentDelayLabelAndComboBox = new LabelAndComboBox();
            paymentDelayLabelAndComboBox.setLabel("Ech\351ance de paiement");
            paymentDelayLabelAndComboBox.setToolTipText("En jour(s)");
            paymentDelayLabelAndComboBox.setList(new String[]{
                        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
                        "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
                        "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
                        "30", "31", "60", "90", "120", "180"
                    });
            paymentDelayLabelAndComboBox.setSelectedIndex(0);
        }
        return paymentDelayLabelAndComboBox;
    }

    private LabelAndTextField getDiscountLabelAndTextField() {
        if (discountLabelAndTextField == null) {
            discountLabelAndTextField = new LabelAndTextField();
            discountLabelAndTextField.setLabel("Remise bas de page");
            discountLabelAndTextField.getTextField().setHorizontalAlignment(4);
        }
        return discountLabelAndTextField;
    }

    private LabelAndTextField getExtraDiscountLabelAndTextField() {
        if (extraDiscountLabelAndTextField == null) {
            extraDiscountLabelAndTextField = new LabelAndTextField();
            extraDiscountLabelAndTextField.setLabel("Remise fid\350lit\351");
            extraDiscountLabelAndTextField.getTextField().setHorizontalAlignment(4);
        }
        return extraDiscountLabelAndTextField;
    }

    private LabelAndTextField getExtraDiscountLevelLabelAndTextField() {
        if (extraDiscountLevelLabelAndTextField == null) {
            extraDiscountLevelLabelAndTextField = new LabelAndTextField();
            extraDiscountLevelLabelAndTextField.setLabel("Quota fid\350lit\351");
            extraDiscountLevelLabelAndTextField.getTextField().setHorizontalAlignment(4);
        }
        return extraDiscountLevelLabelAndTextField;
    }

    private LabelAndTextField getTotalPaymentLabelAndTextField() {
        if (totalPaymentLabelAndTextField == null) {
            totalPaymentLabelAndTextField = new LabelAndTextField();
            totalPaymentLabelAndTextField.setLabel("Total encaiss\351");
            totalPaymentLabelAndTextField.getTextField().setEditable(false);
            totalPaymentLabelAndTextField.getTextField().setHorizontalAlignment(4);
        }
        return totalPaymentLabelAndTextField;
    }

    private SearchBox getItemSearch() {
        if (itemSearch == null) {
            itemSearch = new SearchBox();
            itemSearch.setPreferredSize(itemSearch.getSize());
            itemSearch.addPropertyChangeListener("icon", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent e) {
                    itemSearch.setPreferredSize(itemSearch.getSize());
                    getMainPanel().revalidate();
                }
            });
        }
        return itemSearch;
    }

    private JPanel getItemDiscountOptionPanel() {
        if (itemDiscountOptionPanel == null) {
            FlowLayout flowLayout12 = new FlowLayout();
            itemDiscountOptionPanel = new JPanel();
            itemDiscountOptionPanel.setLayout(flowLayout12);
            flowLayout12.setAlignment(2);
            itemDiscountOptionPanel.add(getNetPriceCalculatorCheckBox(), null);
        }
        return itemDiscountOptionPanel;
    }

    private JCheckBox getNetPriceCalculatorCheckBox() {
        if (netPriceCalculatorCheckBox == null) {
            netPriceCalculatorCheckBox = new JCheckBox();
            netPriceCalculatorCheckBox.setPreferredSize(new Dimension(300, 21));
            netPriceCalculatorCheckBox.setHorizontalAlignment(2);
            netPriceCalculatorCheckBox.setText("Calculer la remise  (saisir le prix net)                      ");
            netPriceCalculatorCheckBox.setHorizontalTextPosition(2);
        }
        return netPriceCalculatorCheckBox;
    }

    public int getSelectedDiscountPanel() {
        return getJTabbedPane2().getSelectedIndex();
    }

    public SearchBox getCustomerSearchBox() {
        return getCustomerSearch();
    }

    public SearchBox getItemSearchBox() {
        return getItemSearch();
    }

    public BasicMenu getMenuPanel() {
        return getBasicMenu();
    }

    public IconBar getIconBarPanel() {
        return getIconBar();
    }

    public TableViewer getItemDiscountTable() {
        return getItemDiscountTableViewer();
    }

    public TableViewer getFamilyItemDiscountTable() {
        return getFamilyItemDiscountTableViewer();
    }

    public boolean isCalculatorSelected() {
        return getNetPriceCalculatorCheckBox().isSelected();
    }

    public String getCompanyValue() {
        return getCompanyLabelAndTextField().getVal();
    }

    public void setCompanyValue(String txt) {
        getCompanyLabelAndTextField().setVal(txt);
    }

    public String getStatusValue() {
        return getStatusLabelAndComboBox().getSelectedString();
    }

    public void setStatusValue(String txt) {
        getStatusLabelAndComboBox().setSelectedString(txt);
    }

    public String getSalesAddrLn1Value() {
        return getSalesAddrLn1abelAndTextField().getVal();
    }

    public void setSalesAddrLn1Value(String txt) {
        getSalesAddrLn1abelAndTextField().setVal(txt);
    }

    public String getSalesAddrLn2Value() {
        return getSalesAddrLn2abelAndTextField().getVal();
    }

    public void setSalesAddrLn2Value(String txt) {
        getSalesAddrLn2abelAndTextField().setVal(txt);
    }

    public String getSalesCityValue() {
        return getSalesCityLabelAndTextField().getVal();
    }

    public void setSalesCityValue(String txt) {
        getSalesCityLabelAndTextField().setVal(txt);
    }

    public String getSalesCountryValue() {
        return getSalesCountryLabelAndTextField().getVal();
    }

    public void setSalesCountryValue(String txt) {
        getSalesCountryLabelAndTextField().setVal(txt);
    }

    public String getSalesZipValue() {
        return getSalesZipLabelAndTextField().getVal();
    }

    public void setSalesZipValue(String txt) {
        getSalesZipLabelAndTextField().setVal(txt);
    }

    public String getContactValue() {
        return getContactLabelAndTextField().getVal();
    }

    public void setContactValue(String txt) {
        getContactLabelAndTextField().setVal(txt);
    }

    public String getJobContactValue() {
        return getJobContactLabelAndTextField().getVal();
    }

    public void setJobContactValue(String txt) {
        getJobContactLabelAndTextField().setVal(txt);
    }

    public String getTelValue() {
        return getTelLabelAndTextField().getVal();
    }

    public void setTelValue(String txt) {
        getTelLabelAndTextField().setVal(txt);
    }

    public String getFaxValue() {
        return getFaxLabelAndTextField().getVal();
    }

    public void setFaxValue(String txt) {
        getFaxLabelAndTextField().setVal(txt);
    }

    public String getShippingAddrLn1Value() {
        return getShippingAddrLn1LabelAndTextField().getVal();
    }

    public void setShippingAddrLn1Value(String txt) {
        getShippingAddrLn1LabelAndTextField().setVal(txt);
    }

    public String getShippingAddrLn2Value() {
        return getShippingAddrLn2LabelAndTextField().getVal();
    }

    public void setShippingAddrLn2Value(String txt) {
        getShippingAddrLn2LabelAndTextField().setVal(txt);
    }

    public String getShippingCityValue() {
        return getShippingCityLabelAndTextField().getVal();
    }

    public void setShippingCityValue(String txt) {
        getShippingCityLabelAndTextField().setVal(txt);
    }

    public String getShippingZipValue() {
        return getShippingZipLabelAndTextField().getVal();
    }

    public void setShippingZipValue(String txt) {
        getShippingZipLabelAndTextField().setVal(txt);
    }

    public String getShippingCountryValue() {
        return getShippingCountryLabelAndTextField().getVal();
    }

    public void setShippingCountryValue(String txt) {
        getShippingCountryLabelAndTextField().setVal(txt);
    }

    public String getGlnValue() {
        return getGlnLabelAndTextField().getVal();
    }

    public void setGlnValue(String txt) {
        getGlnLabelAndTextField().setVal(txt);
    }

    public String getEmailValue() {
        return getEmailLabelAndTextField().getVal();
    }

    public void setEmailValue(String txt) {
        getEmailLabelAndTextField().setVal(txt);
    }

    public String getWebValue() {
        return getWebLabelAndTextField().getVal();
    }

    public void setWebValue(String txt) {
        getWebLabelAndTextField().setVal(txt);
    }

    public String getTel2Value() {
        return getTel2LabelAndTextField().getVal();
    }

    public void setTel2Value(String txt) {
        getTel2LabelAndTextField().setVal(txt);
    }

    public String getFamilyValue() {
        return getFamilyLabelAndComboBox().getSelectedString();
    }

    public void setFamilyValue(String txt) {
        getFamilyLabelAndComboBox().setSelectedString(txt);
    }

    public void setFamilyIndex(int index) {
        getFamilyLabelAndComboBox().setSelectedIndex(index);
    }

    public void setFamilyList(String list[]) {
        getFamilyLabelAndComboBox().setList(list);
    }

    public JComboBox getFamilyComboBox() {
        return getFamilyLabelAndComboBox().getComboBox();
    }

    public String getBankNumberValue() {
        return getBankNumberLabelAndTextField().getVal();
    }

    public void setBankNumberValue(String txt) {
        getBankNumberLabelAndTextField().setVal(txt);
    }

    public String getLastUserValue() {
        return getLastUserLabelAndTextField().getVal();
    }

    public void setLastUserValue(String txt) {
        getLastUserLabelAndTextField().setVal(txt);
    }

    public String getLastTimeValue() {
        return getLastTimeLabelAndTextField().getVal();
    }

    public void setLastTimeValue(String txt) {
        getLastTimeLabelAndTextField().setVal(txt);
    }

    public String getIdValue() {
        return getIdLabelAndTextField().getVal();
    }

    public void setIdValue(String txt) {
        getIdLabelAndTextField().setVal(txt);
    }

    public String getNotesValue() {
        return getNotesJTextArea().getText();
    }

    public void setNotesValue(String txt) {
        getNotesJTextArea().setText(txt);
    }

    public String getSalesPerson() {
        return getSalesPersonLabelAndComboBox().getSelectedString();
    }

    public void setSalesPerson(String txt) {
        getSalesPersonLabelAndComboBox().setSelectedString(txt);
    }

    public void setSalesPersonList(String list[]) {
        getSalesPersonLabelAndComboBox().setList(list);
    }

    public void setSalesPersonIndex(int index) {
        getSalesPersonLabelAndComboBox().setSelectedIndex(index);
    }

    public int getSalesPersonIndex() {
        return getSalesPersonLabelAndComboBox().getSelectedIndex();
    }

    public String getPaymentMode() {
        return getPaymentModeLabelAndComboBox().getSelectedString();
    }

    public void setPaymentMode(String txt) {
        getPaymentModeLabelAndComboBox().setSelectedString(txt);
    }

    public void setPaymentModeList(String list[]) {
        getPaymentModeLabelAndComboBox().setList(list);
    }

    public void setPaymentModeIndex(int index) {
        getPaymentModeLabelAndComboBox().setSelectedIndex(index);
    }

    public String getPaymentDelay() {
        return getPaymentDelayLabelAndComboBox().getSelectedString();
    }

    public void setPaymentDelay(String txt) {
        getPaymentDelayLabelAndComboBox().setSelectedString(txt);
    }

    public void setPaymentDelayList(String list[]) {
        getPaymentDelayLabelAndComboBox().setList(list);
    }

    public void setPaymentDelayIndex(int index) {
        getPaymentDelayLabelAndComboBox().setSelectedIndex(index);
    }

    public String getDiscount() {
        return getDiscountLabelAndTextField().getVal();
    }

    public void setDiscount(String txt) {
        getDiscountLabelAndTextField().setVal(txt);
    }

    public String getExtraDiscount() {
        return getExtraDiscountLabelAndTextField().getVal();
    }

    public void setExtraDiscount(String txt) {
        getExtraDiscountLabelAndTextField().setVal(txt);
    }

    public String getExtraDiscountLevel() {
        return getExtraDiscountLevelLabelAndTextField().getVal();
    }

    public void setExtraDiscountLevel(String txt) {
        getExtraDiscountLevelLabelAndTextField().setVal(txt);
    }

    public String getTotalPayment() {
        return getTotalPaymentLabelAndTextField().getVal();
    }

    public void setTotalPayment(String txt) {
        getTotalPaymentLabelAndTextField().setVal(txt);
    }

    public void cleanField() {
        setCompanyValue("");
        setStatusValue("");
        setSalesAddrLn1Value("");
        setSalesAddrLn2Value("");
        setSalesCityValue("");
        setSalesCountryValue("");
        setSalesZipValue("");
        setContactValue("");
        setJobContactValue("");
        setTelValue("");
        setFaxValue("");
        setShippingAddrLn1Value("");
        setShippingAddrLn2Value("");
        setShippingCityValue("");
        setShippingZipValue("");
        setShippingCountryValue("");
        setGlnValue("");
        setEmailValue("");
        setWebValue("");
        setTel2Value("");
        setFamilyValue("");
        setBankNumberValue("");
        setLastUserValue("");
        setLastTimeValue("");
        setIdValue("");
        setNotesValue("");
        setTotalPayment("0.00");
        setExtraDiscountLevel("0.00");
        setExtraDiscount("0.00");
        setDiscount("0.00");
        setSalesPersonIndex(0);
        setPaymentDelayIndex(0);
        setPaymentModeIndex(0);
        setTitle("CLIENT");
    }

    public void setEnabledField(boolean b) {
        getCompanyLabelAndTextField().getTextField().setEditable(b);
        getStatusLabelAndComboBox().getComboBox().setEnabled(b);
        getSalesAddrLn1abelAndTextField().getTextField().setEditable(b);
        getSalesAddrLn2abelAndTextField().getTextField().setEditable(b);
        getSalesCityLabelAndTextField().getTextField().setEditable(b);
        getSalesCountryLabelAndTextField().getTextField().setEditable(b);
        getSalesZipLabelAndTextField().getTextField().setEditable(b);
        getContactLabelAndTextField().getTextField().setEditable(b);
        getJobContactLabelAndTextField().getTextField().setEditable(b);
        getTelLabelAndTextField().getTextField().setEditable(b);
        getFaxLabelAndTextField().getTextField().setEditable(b);
        getShippingAddrLn1LabelAndTextField().getTextField().setEditable(b);
        getShippingAddrLn2LabelAndTextField().getTextField().setEditable(b);
        getShippingCityLabelAndTextField().getTextField().setEditable(b);
        getShippingZipLabelAndTextField().getTextField().setEditable(b);
        getShippingCountryLabelAndTextField().getTextField().setEditable(b);
        getGlnLabelAndTextField().getTextField().setEditable(b);
        getEmailLabelAndTextField().getTextField().setEditable(b);
        getWebLabelAndTextField().getTextField().setEditable(b);
        getTel2LabelAndTextField().getTextField().setEditable(b);
        getFamilyLabelAndComboBox().getComboBox().setEnabled(b);
        getBankNumberLabelAndTextField().getTextField().setEditable(b);
        getIdLabelAndTextField().getTextField().setEditable(b);
        getNotesJTextArea().setEditable(b);
        getExtraDiscountLevelLabelAndTextField().getTextField().setEditable(b);
        getExtraDiscountLabelAndTextField().getTextField().setEditable(b);
        getDiscountLabelAndTextField().getTextField().setEditable(b);
        getPaymentDelayLabelAndComboBox().getComboBox().setEnabled(b);
        getPaymentModeLabelAndComboBox().getComboBox().setEnabled(b);
        getSalesPersonLabelAndComboBox().getComboBox().setEnabled(b);
    }

    private JScrollPane getJScrollPane1() {
        if (jScrollPane1 == null) {
            jScrollPane1 = new JScrollPane();
            jScrollPane1.setViewportView(getJTabbedPane());
            jScrollPane1.setHorizontalScrollBarPolicy(31);
            jScrollPane1.setPreferredSize(new Dimension(306, 380));
        }
        return jScrollPane1;
    }
    private JPanel jContentPane;
    private BasicMenu basicMenu;
    private IconBar iconBar;
    private JPanel mainPanel;
    private SearchBox customerSearch;
    private JTabbedPane jTabbedPane;
    private JPanel addressPanel;
    private JPanel infosPanel;
    private JTabbedPane jTabbedPane1;
    private JPanel salesAddressPanel;
    private JPanel shippingAddressPanel;
    private JPanel companyPanel;
    private LabelAndTextField companyLabelAndTextField;
    private LabelAndComboBox statusLabelAndComboBox;
    private LabelAndTextField salesAddrLn1abelAndTextField;
    private LabelAndTextField salesAddrLn2abelAndTextField;
    private LabelAndTextField salesCityLabelAndTextField;
    private LabelAndTextField salesCountryLabelAndTextField;
    private LabelAndTextField salesZipLabelAndTextField;
    private JPanel contactPanel;
    private LabelAndTextField contactLabelAndTextField;
    private LabelAndTextField jobContactLabelAndTextField;
    private LabelAndTextField telLabelAndTextField;
    private LabelAndTextField faxLabelAndTextField;
    private LabelAndTextField shippingAddrLn1LabelAndTextField;
    private LabelAndTextField shippingAddrLn2LabelAndTextField;
    private LabelAndTextField shippingCityLabelAndTextField;
    private LabelAndTextField shippingZipLabelAndTextField;
    private LabelAndTextField shippingCountryLabelAndTextField;
    private LabelAndTextField glnLabelAndTextField;
    private LabelAndTextField emailLabelAndTextField;
    private LabelAndTextField webLabelAndTextField;
    private LabelAndTextField tel2LabelAndTextField;
    private LabelAndComboBox familyLabelAndComboBox;
    private LabelAndTextField bankNumberLabelAndTextField;
    private LabelAndTextField lastUserLabelAndTextField;
    private LabelAndTextField lastTimeLabelAndTextField;
    private LabelAndTextField idLabelAndTextField;
    private JScrollPane jScrollPane;
    private JTextArea notesJTextArea;
    private JPanel accountingPanel;
    private JPanel discountPanel;
    private JTabbedPane jTabbedPane2;
    private JPanel itemDiscountPanel;
    private JPanel familyItemDiscountPanel;
    private TableViewer itemDiscountTableViewer;
    private TableViewer familyItemDiscountTableViewer;
    private LabelAndComboBox salesPersonLabelAndComboBox;
    private LabelAndComboBox paymentModeLabelAndComboBox;
    private LabelAndComboBox paymentDelayLabelAndComboBox;
    private LabelAndTextField discountLabelAndTextField;
    private LabelAndTextField extraDiscountLabelAndTextField;
    private LabelAndTextField extraDiscountLevelLabelAndTextField;
    private LabelAndTextField totalPaymentLabelAndTextField;
    private SearchBox itemSearch;
    private JPanel itemDiscountOptionPanel;
    private JCheckBox netPriceCalculatorCheckBox;
    private JScrollPane jScrollPane1;
}
